<template>
  <view class="content">
    <view class="page-body">
      <view class="page-section page-section-gap">
        <map
          style="width: 750rpx; height: 500rpx"
          :latitude="latitude"
          :longitude="longitude"
          :scale="scale"
          :markers="covers"
          :highAccuracyExpireTime="highAccuracyExpireTime"
        >
        </map>
      </view>
    </view>
    <button @click="getweihzi">我的位置</button>
    <button @click="go">op</button>
  </view>
</template>
<script>
import { imgPath } from "../../static/didian.svg";
export default {
  data() {
    return {
      id: 0, // 使用 marker点击事件 需要填写id
      title: "map",
      latitude: "30.4627",
      longitude: "114.4244",
      scale: 20,
      highAccuracyExpireTime: true,
      covers: [
        {
          latitude: 30.4627,
          longitude: 114.4244,
          iconPath: "",
        },
      ],
    };
  },
  onLoad() {
    this.getweihzi();
  },
  methods: {
    go() {
      tt.login({
        force: true,
        success(res) {
          console.log(res);
        },
        fail(res) {
          console.log(`login 调用失败`);
        },
      });

      uni.authorize({
        scope: "scope.userInfo",
        desc: "用于登录",
        success() {
          uni.getUserInfo({
            success: function (res) {
              console.log(res);
            },
          });
        },
        fail: function (res) {
          console.log(res);
        },
      });
    },
    getUSers() {
      uni.authorize({
        scope: "scope.userInfo",
        success() {
          uni.getUserInfo();
        },
      });
    },

    getweihzi() {
      var thad = this;
      uni.getLocation({
        type: "gcj02",
        success: function (res) {
          console.log(res);
          thad.longitude = res.longitude;
          thad.latitude = res.latitude;
          console.log("当前位置的经度：" + res.longitude);
          console.log("当前位置的纬度：" + res.latitude);
        },
      });
    },
  },
};
</script>

<style>
</style>